package com.qczl.weather.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qczl.core.util.DateUtil;
import com.qczl.weather.dao.CityMapper;
import com.qczl.weather.dao.InfoMapper;
import com.qczl.weather.pojo.City;
import com.qczl.weather.pojo.Info;
import com.qczl.weather.service.InfoService;

/**
 * 天气信息业务逻辑层实现类
 * @author SongR
 *
 */
@Service
public class InfoServiceImpl implements InfoService{

	@Resource
	CityMapper cDao;
	@Resource
	InfoMapper iDao;
	
	public Info getByCity(String cityName) throws Exception{
		City c = cDao.select(cityName);
		Info inf = null;
		if(null!=c){
			Map<String,Object> m = new HashMap<String,Object>();
			m.put("wea_id", c.getCityId());
			m.put("starttime", DateUtil.getStartTime());
			inf= iDao.selectByCity(m);
		}
		return inf;
	}
	
	
	
}
